package org.testis.testdriver.parser;

import org.testis.testdriver.ITestBuilder;
import org.testis.testdriver.TestPlanBuilder;
import org.orm.PersistentException;
import org.testis.orm.refinedclasses.TestDesignTreeNode;
import org.testis.orm.refinedclasses.TestSuiteRefined;

/**
 *
 * @author barisergun
 */
public class TestDriverTestSuiteRefinedParsing extends TestDriverAbstractParsingStrategy{

    public TestDriverTestSuiteRefinedParsing(ITestBuilder builder,
                                 TestDesignTreeNode currentNode)
    {
        m_builder = builder;
        m_currentNode = currentNode;
        
        if (m_currentNode.isClone()) {
            m_cloneString = " [clone]";
        }
    }
    
    @Override
    public void parseCurrentNode () throws PersistentException
    {
        ((TestPlanBuilder)m_builder).resetExceptions();
        TestSuiteRefined testPart =
                (TestSuiteRefined) m_currentNode.getObject();
            m_builder.buildTestSuite(String.valueOf(m_currentNode.getId()),
                                   testPart.getName() + m_cloneString,
                                   testPart.getReference().getDescription());

    }

}
